﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using OgilvyOne.Model;
using OgilvyOne.BLL;

public partial class admin_infomation_info_video_list : AdminBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (!IsPostBack)
        {
            this.PopedomValidate(Layerid, QUERY);
            //this.headers.Text = new ColumnBll().LayeridColumnConNaiv(Request.Params["layerid"]);
            Grid_viewBild();
        }
    }

    private void Grid_viewBild()
    {

        int aid = int.Parse(Request.Params["aid"]);

        CmsArticleModel cm = new CmsArticleBll().GetCmsArticleModel(aid);
        this.headers.Text = "当前位置：" + cm.Title + "&nbsp;&nbsp;<img src='../images/subnav_dot.gif' />&nbsp;&nbsp;相关视频";

        /*if (Request.Params["pageNum"] != null && Request.Params["pageNum"] != "")
        {
            try
            {
                GridView1.PageIndex = int.Parse(Request.Params["pageNum"]) - 1;
            }
            catch { }
        }*/
        CmsArticleVideoModel im = new CmsArticleVideoModel();
        im.ArticleId = aid;
        IList datalist = new CmsArticleVideoBll().GetVideoList(im);


        GridView1.DataSource = datalist;
        GridView1.AllowPaging = false;
        GridView1.DataBind();
        //this.pagehtml.Text = getPageHtml(GridView1.PageCount, GridView1.PageIndex + 1, datalist.Count);
    }

    protected void Add_click(object sender, EventArgs e)
    {
        this.PopedomValidate(Request.Params["layerid"], ADD);
        Response.Redirect("info_video_detail.aspx?aid=" + Request.Params["aid"] + "&layerid=" + Request.Params["layerid"], true);
    }



    protected void Delone_click(object sender, EventArgs e)
    {
        this.PopedomValidate(Request.Params["layerid"], DEL);
        string videoid = ((LinkButton)sender).CommandArgument;
        string videoname = (new CmsArticleVideoBll().GetVideoModel(int.Parse(videoid))).VideoName;
        bool r = new CmsArticleVideoBll().Delete(int.Parse(videoid));
        if (r)
        {
            insertLog("删除文章视频:" + videoname);
        }
        Grid_viewBild();
    }



    protected void Mod_click(object sender, EventArgs e)
    {
        this.PopedomValidate(Request.Params["layerid"], MOD);
        Response.Redirect("info_video_detail.aspx?aid=" + Request.Params["aid"] + "&layerid=" + Request.Params["layerid"] + "&id=" + ((LinkButton)sender).CommandArgument, true);
    }
}
